package com.freeland.client2009.dao.ibatis.impl;

import javax.annotation.Resource;

import com.freeland.client2009.dao.ibatis.UserInfoDAO;
import com.freeland.client2009.dao.ibatis.model.UserInfo;
import com.ibatis.sqlmap.client.SqlMapClient;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

@Repository("userInfoDao")
public class UserInfoDAOImpl extends SqlMapClientDaoSupport implements UserInfoDAO {

	@Resource(name="sqlMapClient")
	public void setSqlMapClientFactory(SqlMapClient sqlMapClient)
	{
		this.setSqlMapClient(sqlMapClient);
	}
	
    public UserInfoDAOImpl() {
        super();
    }

    public void insert(UserInfo record) {
        getSqlMapClientTemplate().insert("insert_UserInfo", record);
    }

    public int updateByPrimaryKeySelective(UserInfo record) {
        int rows = getSqlMapClientTemplate().update("update_UserInfo_ByPrimaryKeySelective", record);
        return rows;
    }

    public UserInfo selectByPrimaryKey(UserInfo userInfo) {
        UserInfo record = (UserInfo) getSqlMapClientTemplate().queryForObject("select_UserInfo_ByPrimaryKey", userInfo);
        return record;
    }
}